/**
 * 
 */
package za.co.sindi.oauth.core.context.web.servlet.http;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import za.co.sindi.oauth.core.context.HttpRequestContext;
import za.co.sindi.oauth.core.context.HttpResponseContext;
import za.co.sindi.oauth.core.context.SessionContext;
import za.co.sindi.oauth.core.context.web.servlet.ServletApplicationContext;

/**
 * @author Buhake Sindi
 * @since 16 April 2012
 *
 */
public class HttpServletApplicationContext extends ServletApplicationContext {

	/**
	 * @param servletContext
	 * @param servletRequest
	 * @param servletResponse
	 */
	public HttpServletApplicationContext(ServletContext servletContext, HttpServletRequest servletRequest, HttpServletResponse servletResponse) {
		super(servletContext, servletRequest, servletResponse);
		// TODO Auto-generated constructor stub
	}

	/* (non-Javadoc)
	 * @see com.neurologic.oauth.core.context.web.servlet.ServletApplicationContext#getServletRequest()
	 */
	@Override
	public HttpServletRequest getServletRequest() {
		// TODO Auto-generated method stub
		return (HttpServletRequest) super.getServletRequest();
	}

	/* (non-Javadoc)
	 * @see com.neurologic.oauth.core.context.web.servlet.ServletApplicationContext#getServletResponse()
	 */
	@Override
	public HttpServletResponse getServletResponse() {
		// TODO Auto-generated method stub
		return (HttpServletResponse) super.getServletResponse();
	}

	/* (non-Javadoc)
	 * @see com.neurologic.oauth.core.context.web.servlet.ServletApplicationContext#getRequestContext()
	 */
	@Override
	public HttpRequestContext getRequestContext() {
		// TODO Auto-generated method stub
		return new HttpServletRequestContext(getServletRequest());
	}

	/* (non-Javadoc)
	 * @see com.neurologic.oauth.core.context.web.servlet.ServletApplicationContext#getResponseContext()
	 */
	@Override
	public HttpResponseContext getResponseContext() {
		// TODO Auto-generated method stub
		return new HttpServletResponseContext(getServletResponse());
	}

	/* (non-Javadoc)
	 * @see com.neurologic.oauth.core.context.ApplicationContext#getSessionContext()
	 */
	@Override
	public SessionContext getSessionContext() {
		// TODO Auto-generated method stub
		return new HttpSessionContext(getServletRequest().getSession());
	}

	/* (non-Javadoc)
	 * @see com.neurologic.oauth.core.context.ApplicationContext#getSessionContext(boolean)
	 */
	@Override
	public SessionContext getSessionContext(boolean create) {
		// TODO Auto-generated method stub
		return new HttpSessionContext(getServletRequest().getSession(create));
	}
}
